//
//  Node.swift
//  DataStructures
//
//  Created by  iBrother 李彦兵 on 2018/6/17.
//  Copyright © 2018 CEC-CESEC. All rights reserved.
//

import Foundation


public class Node<Value> {
    public var value: Value
    public var next: Node?
    
    public init(value: Value, next: Node? = nil ) {
        self.value = value
        self.next = next
    }
    
    
}


extension Node: CustomStringConvertible {
    public var description: String {
        guard let next = next else {
            return "\(value)"
        }
        return "\(value) -> " + String(describing: next) + " "
    }
}
